﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Configuration;
using ZJF.InterfaceReflection._1.接口反射;


namespace ZJF.InterfaceReflection._2.反射工厂类
{
    public class ObjectFactory
    {

        private static string assName = ConfigurationManager.AppSettings["assName"];

        public static Car GetObject() {
            string className = ConfigurationManager.AppSettings["className"];
            return (Car)Assembly.Load(assName).CreateInstance(className);
        } 
    }
}
